perm filename MAP[E87,JMC] blob sn#846058 filedate 1987-09-17 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	∂06-Sep-87  1615	JSW  	SAIL characters on Lisp machine   
C00009 ENDMK
C⊗;
∂06-Sep-87  1615	JSW  	SAIL characters on Lisp machine   
The list I sent you yesterday had a mistake: it should say

    Symbol-'	<null>
    Symbol-g	↑

Without changing anything, you can get some of the SAIL special keys
as follows:

    [ESCAPE]	Symbol-'
    [BREAK]	Symbol-' -    or  Suspend
    [CALL]	Abort
    [CLEAR]	Clear-Input
    [FORM]	Page          or  Refresh
    [ALT]	Escape        or  Complete

The [VT] key seems to be impossible to type with the default mappings,
however.  There are two tables that can be altered to change what the
keys do: the mapping from keys to characters (which affects their use
in all windows), and the mapping from (non-graphic) characters to SUPDUP
functions, which only has effect in the terminal window.

The second of these is easiest, and I'm using the following in my
lispm-init.lisp file:

(defun set-supdup-key (char code)
  (setf (aref telnet:*supdup-keys*
              (- (char-code char) #o200))
        code))

(set-supdup-key #\Escape   #o4101)              ;Escape
(set-supdup-key #\Refresh  #o4102)              ;Break
(set-supdup-key #\Complete #o13)                ;VT
(set-supdup-key #\Scroll   #o33)                ;Alt

Changing the keyboard-to-character mapping is also not hard, but I've
decided that I don't like it because I haven't internalized the SAIL
keyboard enough to type the special characters without seeing them on the
keys.  Also, not all of the standard characters are in the same places in
the two keyboards (the digits, "+", "-" and ":" in particular), which
makes it hard to decide where to put some of the special characters.

The following will make Symbol (or Shift-Symbol, in most cases) act like
SAIL's Top key for letters, but it leaves some of the special characters
undefined.

(defun set-kbd-hardware-table (hardware-character software-character)
  "Change HARDWARE-CHARACTER to generate SOFTWARE-CHARACTER.  Unfortunately, you
   have to know the index into the hardware kbd array; this is kbd-specific (sorry!).
   SOFTWARE-CHARACTER can be either a single character or a list of the
   symbol-shift permutations.
   This transformation can be undone via (SETQ KBD-NEW-TABLE (KBD-MAKE-NEW-TABLE))"
  ;; Bugs to Gumby@AI.AI.MIT.EDU
  (dotimes (shift 4)
    (setf (aref si:kbd-new-table shift hardware-character)
	  (typecase software-character
	    (character (char-int software-character))
	    (list (if (nth shift software-character)
		      (char-int (nth shift software-character))
		    #o140000))
	    (integer software-character)	; mainly for shifts
	    (t (error "Can't make keyboard entry for ~S" software-character))))))

(defun sail-keyboard ()
  (set-kbd-hardware-table #o20 '(#\z #\Z #\Alpha #\Alpha))
  (set-kbd-hardware-table #o21 '(#\c #\C #\Epsilon #\Epsilon))
  (set-kbd-hardware-table #o22 '(#\b #\B #\Pi #\Pi))
  (set-kbd-hardware-table #o23 '(#\m #\M #\Exists #\Exists))
  (set-kbd-hardware-table #o31 '(#\x #\X #\Beta #\Beta))
  (set-kbd-hardware-table #o32 '(#\v #\V #\Lambda #\Lambda))
  (set-kbd-hardware-table #o33 '(#\n #\N #\All #\All))
  (set-kbd-hardware-table #o41 '(#\s #\S #\Greater-Or-Equal #\Greater-Or-Equal))
  (set-kbd-hardware-table #o42 '(#\f #\F #\> #\>))
  (set-kbd-hardware-table #o43 '(#\h #\H #\= #\=))
  (set-kbd-hardware-table #o44 '(#\k #\K #\Right-Arrow #\Right-Arrow))
  (set-kbd-hardware-table #o45 '(#\; #\: #\Up-Arrow #\Down-Arrow))
  (set-kbd-hardware-table #o51 '(#\a #\A #\Less-Or-Equal #\Less-Or-Equal))
  (set-kbd-hardware-table #o52 '(#\d #\D #\< #\<))
  (set-kbd-hardware-table #o53 '(#\g #\G #\Not-Equal #\Not-Equal))
  (set-kbd-hardware-table #o54 '(#\j #\J #\Left-Arrow #\Left-Arrow))
  (set-kbd-hardware-table #o55 '(#\l #\L #\Double-Arrow #\Double-Arrow))
  (set-kbd-hardware-table #o61 '(#\w #\W #\Or #\Or))
  (set-kbd-hardware-table #o62 '(#\r #\R #\# #\#))
  (set-kbd-hardware-table #o63 '(#\y #\Y #\" #\"))
  (set-kbd-hardware-table #o64 '(#\i #\I #\' #\'))
  (set-kbd-hardware-table #o65 '(#\p #\P #\} #\}))
  (set-kbd-hardware-table #o71 '(#\q #\Q #\And #\And))
  (set-kbd-hardware-table #o72 '(#\e #\E #\@ #\@))
  (set-kbd-hardware-table #o73 '(#\t #\T #\& #\&))
  (set-kbd-hardware-table #o74 '(#\u #\U #\` #\`))
  (set-kbd-hardware-table #o75 '(#\o #\O #\{ #\{))
  )